/*
* Copyright (c) 2020 - 2025 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/***********************************************************************************************************************
 * Includes
 **********************************************************************************************************************/
#include "r_rsip_primitive.h"
#include "r_rsip_reg.h"
#include "r_rsip_util.h"

/***********************************************************************************************************************
 * Macro definitions
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Typedef definitions
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Private function prototypes
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Private global variables
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Global variables
 **********************************************************************************************************************/

/***********************************************************************************************************************
 * Functions
 **********************************************************************************************************************/

RSIP_PRV_PRIMITIVE_FUNC

rsip_ret_t r_rsip_p47f (void)
{
    uint32_t iLoop;
    uint32_t jLoop;
    uint32_t kLoop;
    uint32_t oLoop;
    uint32_t oLoop1;
    uint32_t OFS_ADR;
    (void) iLoop;
    (void) jLoop;
    (void) kLoop;
    (void) oLoop;
    (void) oLoop1;
    (void) OFS_ADR;
    if (0x00000000U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x9f475956U), bswap_32big(0x41c6d345U), bswap_32big(0x64510bccU),
                       bswap_32big(0x542b3ef3U));
    }
    else if (0x00000001U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x1732be2cU), bswap_32big(0xe79abf05U), bswap_32big(0x377b2b35U),
                       bswap_32big(0xda2cc699U));
    }
    else if (0x00000002U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x9932bc6dU), bswap_32big(0x6b25d368U), bswap_32big(0x7c2ea120U),
                       bswap_32big(0x5fd6c4caU));
    }
    else if (0x00000003U == RD1_MASK(REG_1440H, 0xffffffffU))
    {
        r_rsip_func101(bswap_32big(0x8eeda1deU), bswap_32big(0x77db7d9eU), bswap_32big(0x800ab544U),
                       bswap_32big(0xf38ca8d3U));
    }

    r_rsip_func102(bswap_32big(0xc2f4013eU),
                   bswap_32big(0x4bcf6017U),
                   bswap_32big(0x388c0400U),
                   bswap_32big(0x9712c1b8U));
    WR1_PROG(REG_14BCH, 0x00000040U);
    WAIT_STS(REG_142CH, 12U, 0U);

    return RSIP_RET_PASS;
}
